package com.wiserp.rest.resource;

import org.restlet.resource.Get;
import org.restlet.resource.Put;
import org.restlet.resource.ResourceException;
import org.restlet.resource.ServerResource;

import com.wiserp.rest.helper.SuppInvHelper;
import com.wiserp.rest.model.OpResult;
import com.wiserp.rest.model.SuppInv;

public class SuppInvsResource extends ServerResource{
	private SuppInvHelper helper;
	private String flowNo;
    protected void doInit() throws ResourceException {
    	Object flowNoParam = getRequestAttributes().get("flowNo");
    	if(flowNoParam!=null)
    		flowNo = (String)flowNoParam;	
	}
    
   
    @Get
    public Object findSomething(){
    	if(flowNo != null)
    		return helper.getByFlowNo(flowNo);
    	else
    		return helper.findUnpost();
    }
    
    @Put
    public OpResult uploadBill(SuppInv data){
    	return helper.updateInfo(data);
    }

	public void setHelper(SuppInvHelper helper) {
		this.helper = helper;
	}
}
